<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>购物车 - 邦伴用户端</title>
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
  <style>
    :root {
      --primary: #ff7e2d;
      --primary-light: #fff3ea;
      --border: #f0f0f0;
      --text-main: #222;
      --text-sub: #888;
    }
    
    body {
      font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
      background-color: #f8f8f8;
      color: var(--text-main);
    }
    
    .app-container {
      width: 375px;
      height: 812px;
      margin: 0 auto;
      background: #fff;
      position: relative;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
      overflow-y: auto;
    }
    
    .primary-color {
      color: var(--primary);
    }
    
    .primary-bg {
      background-color: var(--primary);
    }
    
    .primary-light-bg {
      background-color: var(--primary-light);
    }
    
    .btn-primary {
      background-color: var(--primary);
      color: white;
    }
    
    .btn-outline {
      border: 1px solid var(--primary);
      color: var(--primary);
    }
    
    .card {
      border-radius: 12px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    
    .checkbox-custom {
      width: 18px;
      height: 18px;
      border: 1px solid #e5e7eb;
      border-radius: 4px;
      position: relative;
      display: inline-block;
      vertical-align: middle;
      margin-right: 8px;
    }
    
    .checkbox-custom.checked {
      background-color: var(--primary);
      border-color: var(--primary);
    }
    
    .checkbox-custom.checked:after {
      content: '';
      position: absolute;
      left: 6px;
      top: 3px;
      width: 5px;
      height: 9px;
      border: solid white;
      border-width: 0 2px 2px 0;
      transform: rotate(45deg);
    }
    
    .quantity-control {
      display: flex;
      align-items: center;
      border: 1px solid #e5e7eb;
      border-radius: 4px;
      overflow: hidden;
    }
    
    .quantity-btn {
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: #f9fafb;
      cursor: pointer;
      user-select: none;
    }
    
    .quantity-input {
      width: 40px;
      height: 28px;
      border: none;
      border-left: 1px solid #e5e7eb;
      border-right: 1px solid #e5e7eb;
      text-align: center;
      font-size: 14px;
    }
    
    .quantity-input:focus {
      outline: none;
    }
  </style>
</head>
<body>
  <div class="app-container">
    <!-- 顶部导航栏 -->
    <div class="sticky top-0 z-10 bg-white border-b border-gray-100 px-4 py-3 flex items-center">
      <a href="javascript:history.back()" class="mr-2">
        <i class="fas fa-arrow-left text-lg"></i>
      </a>
      <h1 class="text-lg font-medium flex-1 text-center">购物车</h1>
      <span class="text-sm text-gray-500">管理</span>
    </div>
    
    <!-- 空状态 -->
    <div class="hidden flex flex-col items-center justify-center h-96">
      <div class="w-24 h-24 rounded-full bg-gray-100 flex items-center justify-center mb-4">
        <i class="fas fa-shopping-cart text-gray-300 text-3xl"></i>
      </div>
      <p class="text-gray-500 mb-4">购物车还是空的</p>
      <a href="#" class="btn-primary px-8 py-2 rounded-full">去逛逛</a>
    </div>
    
    <!-- 购物车列表 -->
    <div class="p-4">
      <!-- 商家分组 -->
      <div class="mb-4">
        <div class="flex items-center mb-3">
          <div class="checkbox-custom checked"></div>
          <span class="font-medium">康复护理旗舰店</span>
        </div>
        
        <!-- 商品项 -->
        <div class="bg-white rounded-lg p-3 mb-3 flex">
          <div class="checkbox-custom checked mr-2 mt-10"></div>
          <div class="w-20 h-20 bg-gray-100 rounded-lg overflow-hidden mr-3">
            <img src="https://via.placeholder.com/80" alt="商品图片" class="w-full h-full object-cover">
          </div>
          <div class="flex-1">
            <h3 class="text-sm font-medium mb-1">老人专用血压计 家用上臂式全自动高精准</h3>
            <p class="text-xs text-gray-500 mb-2">规格：上臂式 | 白色</p>
            <div class="flex items-center justify-between">
              <span class="text-sm primary-color font-bold">¥199.00</span>
              <div class="quantity-control">
                <div class="quantity-btn minus">-</div>
                <input type="text" class="quantity-input" value="1" readonly>
                <div class="quantity-btn plus">+</div>
              </div>
            </div>
          </div>
        </div>
        
        <div class="bg-white rounded-lg p-3 mb-3 flex">
          <div class="checkbox-custom checked mr-2 mt-10"></div>
          <div class="w-20 h-20 bg-gray-100 rounded-lg overflow-hidden mr-3">
            <img src="https://via.placeholder.com/80" alt="商品图片" class="w-full h-full object-cover">
          </div>
          <div class="flex-1">
            <h3 class="text-sm font-medium mb-1">老人防滑拐杖 可伸缩折叠轻便</h3>
            <p class="text-xs text-gray-500 mb-2">规格：标准版 | 黑色</p>
            <div class="flex items-center justify-between">
              <span class="text-sm primary-color font-bold">¥89.00</span>
              <div class="quantity-control">
                <div class="quantity-btn minus">-</div>
                <input type="text" class="quantity-input" value="1" readonly>
                <div class="quantity-btn plus">+</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 商家分组 -->
      <div class="mb-4">
        <div class="flex items-center mb-3">
          <div class="checkbox-custom checked"></div>
          <span class="font-medium">母婴用品专营店</span>
        </div>
        
        <!-- 商品项 -->
        <div class="bg-white rounded-lg p-3 mb-3 flex">
          <div class="checkbox-custom checked mr-2 mt-10"></div>
          <div class="w-20 h-20 bg-gray-100 rounded-lg overflow-hidden mr-3">
            <img src="https://via.placeholder.com/80" alt="商品图片" class="w-full h-full object-cover">
          </div>
          <div class="flex-1">
            <h3 class="text-sm font-medium mb-1">婴儿洗护套装 天然无刺激</h3>
            <p class="text-xs text-gray-500 mb-2">规格：6件套</p>
            <div class="flex items-center justify-between">
              <span class="text-sm primary-color font-bold">¥128.00</span>
              <div class="quantity-control">
                <div class="quantity-btn minus">-</div>
                <input type="text" class="quantity-input" value="2" readonly>
                <div class="quantity-btn plus">+</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 商家分组 -->
      <div class="mb-4">
        <div class="flex items-center mb-3">
          <div class="checkbox-custom"></div>
          <span class="font-medium">健康食品专营店</span>
        </div>
        
        <!-- 商品项 -->
        <div class="bg-white rounded-lg p-3 mb-3 flex">
          <div class="checkbox-custom mr-2 mt-10"></div>
          <div class="w-20 h-20 bg-gray-100 rounded-lg overflow-hidden mr-3">
            <img src="https://via.placeholder.com/80" alt="商品图片" class="w-full h-full object-cover">
          </div>
          <div class="flex-1">
            <h3 class="text-sm font-medium mb-1">有机燕麦片 即食早餐谷物</h3>
            <p class="text-xs text-gray-500 mb-2">规格：1.5kg装</p>
            <div class="flex items-center justify-between">
              <span class="text-sm primary-color font-bold">¥59.90</span>
              <div class="quantity-control">
                <div class="quantity-btn minus">-</div>
                <input type="text" class="quantity-input" value="1" readonly>
                <div class="quantity-btn plus">+</div>
              </div>
            </div>
          </div>
        </div>
        
        <div class="bg-white rounded-lg p-3 mb-3 flex">
          <div class="checkbox-custom mr-2 mt-10"></div>
          <div class="w-20 h-20 bg-gray-100 rounded-lg overflow-hidden mr-3">
            <img src="https://via.placeholder.com/80" alt="商品图片" class="w-full h-full object-cover">
          </div>
          <div class="flex-1">
            <h3 class="text-sm font-medium mb-1">蓝莓干 无添加剂</h3>
            <p class="text-xs text-gray-500 mb-2">规格：250g装</p>
            <div class="flex items-center justify-between">
              <span class="text-sm primary-color font-bold">¥45.80</span>
              <div class="quantity-control">
                <div class="quantity-btn minus">-</div>
                <input type="text" class="quantity-input" value="1" readonly>
                <div class="quantity-btn plus">+</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 猜你喜欢 -->
    <div class="px-4 py-3 bg-gray-50">
      <h2 class="text-base font-medium mb-3">猜你喜欢</h2>
      <div class="grid grid-cols-2 gap-3">
        <div class="bg-white rounded-lg p-2">
          <div class="w-full h-32 bg-gray-100 rounded-lg overflow-hidden mb-2">
            <img src="https://via.placeholder.com/150" alt="商品图片" class="w-full h-full object-cover">
          </div>
          <h3 class="text-sm mb-1 line-clamp-2">老人按摩椅家用全身多功能电动沙发</h3>
          <p class="text-xs primary-color font-bold">¥1,299.00</p>
        </div>
        <div class="bg-white rounded-lg p-2">
          <div class="w-full h-32 bg-gray-100 rounded-lg overflow-hidden mb-2">
            <img src="https://via.placeholder.com/150" alt="商品图片" class="w-full h-full object-cover">
          </div>
          <h3 class="text-sm mb-1 line-clamp-2">婴儿推车轻便折叠高景观双向避震</h3>
          <p class="text-xs primary-color font-bold">¥899.00</p>
        </div>
      </div>
    </div>
    
    <!-- 底部结算栏 -->
    <div class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-100 px-4 py-3 flex items-center justify-between" style="width: 375px; margin: 0 auto;">
      <div class="flex items-center">
        <div class="checkbox-custom checked"></div>
        <span class="text-sm">全选</span>
      </div>
      <div class="flex items-center">
        <div class="mr-4">
          <p class="text-xs text-gray-500">合计：<span class="text-sm primary-color font-bold">¥416.00</span></p>
          <p class="text-xs text-gray-500">已选4件商品</p>
        </div>
        <a href="checkout.html" class="btn-primary px-8 py-2 rounded-full">结算</a>
      </div>
    </div>
    
    <!-- 底部空间 -->
    <div class="pb-20"></div>
  </div>

  <script>
    document.addEventListener('DOMContentLoaded', function() {
      // 复选框选择
      const checkboxes = document.querySelectorAll('.checkbox-custom');
      checkboxes.forEach(checkbox => {
        checkbox.addEventListener('click', function() {
          this.classList.toggle('checked');
          updateTotalPrice();
        });
      });
      
      // 全选功能
      const selectAllCheckbox = document.querySelector('.fixed.bottom-0 .checkbox-custom');
      selectAllCheckbox.addEventListener('click', function() {
        const isChecked = this.classList.contains('checked');
        checkboxes.forEach(checkbox => {
          if (isChecked) {
            checkbox.classList.add('checked');
          } else {
            checkbox.classList.remove('checked');
          }
        });
        updateTotalPrice();
      });
      
      // 数量加减
      const minusBtns = document.querySelectorAll('.quantity-btn.minus');
      const plusBtns = document.querySelectorAll('.quantity-btn.plus');
      
      minusBtns.forEach(btn => {
        btn.addEventListener('click', function() {
          const input = this.nextElementSibling;
          let value = parseInt(input.value);
          if (value > 1) {
            value--;
            input.value = value;
            updateTotalPrice();
          }
        });
      });
      
      plusBtns.forEach(btn => {
        btn.addEventListener('click', function() {
          const input = this.previousElementSibling;
          let value = parseInt(input.value);
          value++;
          input.value = value;
          updateTotalPrice();
        });
      });
      
      // 更新总价
      function updateTotalPrice() {
        let totalPrice = 0;
        let totalItems = 0;
        
        const itemContainers = document.querySelectorAll('.bg-white.rounded-lg.p-3.mb-3.flex');
        itemContainers.forEach(container => {
          const checkbox = container.querySelector('.checkbox-custom');
          if (checkbox.classList.contains('checked')) {
            const priceText = container.querySelector('.primary-color.font-bold').textContent;
            const price = parseFloat(priceText.replace('¥', ''));
            const quantity = parseInt(container.querySelector('.quantity-input').value);
            totalPrice += price * quantity;
            totalItems += quantity;
          }
        });
        
        document.querySelector('.fixed.bottom-0 .primary-color.font-bold').textContent = '¥' + totalPrice.toFixed(2);
        document.querySelector('.fixed.bottom-0 .text-xs.text-gray-500:last-child').textContent = '已选' + totalItems + '件商品';
      }
    });
  </script>
</body>
</html> 